package com.aiyige.model.request;

import com.aiyige.base.api.ApiManager;
import com.aiyige.base.api.service.ApiService;

import java.util.LinkedList;
import java.util.List;

import okhttp3.ResponseBody;
import retrofit2.Call;

/**
 * Created by zhuyakun on 2017/12/7.
 */

public class PublishCourseVideoImmediateRequest {
    public long goodsId;
    public long version;
    public List<Guarantee> guarantees;

    private PublishCourseVideoImmediateRequest(Builder builder) {
        setGoodsId(builder.goodsId);
        setVersion(builder.version);
        setGuarantees(builder.guarantees);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public static class Guarantee {
        public long id;
        public long configId;
        public boolean isSupply;
    }

    public long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(long goodsId) {
        this.goodsId = goodsId;
    }

    public long getVersion() {
        return version;
    }

    public void setVersion(long version) {
        this.version = version;
    }

    public List<Guarantee> getGuarantees() {
        return guarantees;
    }

    public void setGuarantees(List<Guarantee> guarantees) {
        this.guarantees = guarantees;
    }

    public static final class Builder {
        private long goodsId;
        private long version;
        private List<Guarantee> guarantees;

        private Builder() {
            goodsId = 0;
            version = 0;
            guarantees = new LinkedList<>();
        }

        public Builder goodsId(long goodsId) {
            this.goodsId = goodsId;
            return this;
        }

        public Builder version(long version) {
            this.version = version;
            return this;
        }

        public Builder guarantees(List<Guarantee> guarantees) {
            this.guarantees = guarantees;
            return this;
        }

        public Call<ResponseBody> build() {
            return ApiManager.getService().publishCourseVideoImmediate(new PublishCourseVideoImmediateRequest(this));
        }
    }
}
